\begin{tikzpicture}

	\definecolor{appcolor}        {rgb}{1,1,0.7}
	\definecolor{defaultcolor}    {rgb}{1,1,1}
	\definecolor{criticalcolor}   {rgb}{0.9,0.5,0.4}
	\definecolor{kernelcolor}     {rgb}{0.6,0.8,0.7}
	\definecolor{drivercolor}     {rgb}{0.6,0.7,0.8}

	\tikzstyle{treenode} = [component, path fading=flow fade, align=center,
	                        rounded corners=1, minimum height=6ex]

	\tikzstyle{service} = [draw=black, draw opacity=0.4, ball color=defaultcolor, fill opacity=0.2,
	                       rounded corners=0, shape=semicircle,
	                       inner sep=1.3ex, outer sep=0, above]

	\tikzstyle{appnode}    = [treenode, bottom color=appcolor]
	\tikzstyle{kernelnode} = [treenode, bottom color=kernelcolor, minimum width=18ex]
	\tikzstyle{drivernode} = [treenode, bottom color=drivercolor]

	%
	% Components
	%

	% core / init
	\node[kernelnode] (core) {Core / Init};

	\path (core.north) node[service, scale=0.4] (mmioservice) {};
	\path (mmioservice) node[scale=0.7, yshift=-2ex] {MMIO};

	% gpio test
	\node[appnode, minimum width=18ex, minimum height=16ex, above=4ex of core, align=center]
	     (gpiotest) {};

	\path (gpiotest) node[align=center, xshift=-2ex] {GPIO\\Input Test};

	%
	% Sessions
	%

	\tikzstyle{treesessionarrow} = [arrow, thick]
	\path[treesessionarrow] (mmioservice |- gpiotest.south) -- (mmioservice);

	\tikzstyle{devreg} = [inner sep=0, outer sep=0, draw, anchor=north, minimum width=10ex, minimum height=3ex]

	\path (core)+(35ex,25ex) coordinate (anchor);

	\path (anchor)        node[devreg] (pbcfg0)  {PB\_CFG0};
	\path (pbcfg0.south)  node[devreg] (anchor)  {...};
	\path (anchor.south)  node[devreg] (pbdata)  {PB\_DATA};
	\path (pbdata.south)  node[devreg] (anchor)  {...};
	\path (anchor.south)  node[devreg] (anchor)  {...};
	\path (anchor.south)  node[devreg] (anchor)  {...};
	\path (anchor.south)  node[devreg] (pbpull0) {PB\_PULL0};
	\path (pbpull0.south) node[devreg] (anchor)  {...};
	\path (anchor.south)  node[devreg, opacity=0.5]  (anchor)  {...};
	\path (anchor.south)  node[devreg, opacity=0.2]  (anchor)  {...};
	\path (anchor.south west)  coordinate (lastreg) {};

	\path (pbcfg0.north) node[anchor=south, xshift=2ex] (devregs) {Device Registers};

	\path (pbcfg0)+(26ex,-7ex)
		node [draw, thick, rotate=270, trapezium, trapezium angle=60, minimum width=10ex] (pinmux) {};

	\node[at=(pinmux), scale=0.8] {MUX};

	\path (pinmux.south |- pbdata) coordinate (pbcontact) {};

	\draw (pbdata) -- (pbcontact);
	
	\draw[-] (pbcontact)+(0,1.5ex)  -- ++(-2ex,1.5ex)  node[left, scale=0.5] {UART2\_RTS};
	\draw[-] (pbcontact)+(0,-1.5ex) -- ++(-2ex,-1.5ex) node[left, scale=0.5] {JTAG\_DO0};
	\draw[-] (pbcontact)+(0,-3ex) -- ++(-2ex,-3ex) node[left, scale=0.5] {...};

	\draw[-] (pinmux.north) -- ++(2ex,0) node[align=left, xshift=1ex] (pb2) {PB2\\};
	\draw[-o, densely dotted] (pinmux.north)+(2ex,0) -- ++(12ex,0) node[right,align=center, scale=0.7] (pin27) {Pin 27};

	\path (pin27.west)+(0,-13.5ex) coordinate (pin34) {};
	\path(pin34)+(-5ex,0) coordinate (corner) {};
	\draw[-o] (corner) -- (pin34) node[right, align=center, scale=0.7] {Pin 34};
	\draw (corner) -- ++(0,-5ex) node[ground, scale=0.7] {};

	\path (pin34)+(0,4ex) coordinate (pin8) {};
	\path (pin8)+(-5ex,0) coordinate (vcc) {};
	\path (vcc) node[anchor=east, scale=0.7] {$V_{CC}$};
	\draw[-o] (vcc) -- (pin8) node[right, align=center, scale=0.7] {Pin 8};

	\path (pinmux |- pbcfg0) coordinate (corner) {};
	\draw[->, >= stealth] (pbcfg0) -- (corner) -- (pinmux);

	\path (pbpull0)+(14ex,0) node[draw, thick, trapezium, trapezium angle=60, minimum width=8ex] (pullmux) {};
	\node[at=(pullmux), scale=0.8] {MUX};

	\draw[->, >= stealth] (pbpull0) -- (pullmux);

	\path (pullmux.north) -- node[draw, thick, minimum width=1.5ex, minimum height=4ex] (rpull) {}
	      node[right] {$R_{pull}$} (pullmux.north |- pbdata);

	\draw (pullmux.north) -- (rpull);
	\draw[-] (rpull) -- (pullmux.north |- pbdata) node[circle, fill, inner sep=0.2ex, outer sep=0] {};

	\draw (pullmux.south)+(-2ex,0) -- ++(-2ex,-5ex) node[ground, scale=0.7] {} node[left, scale=0.7, xshift=-2ex, yshift=-3ex]{$ground$};
	\draw (pullmux.south)+(0ex,0) -- ++(0ex,-3ex);
	\draw[-o] (pullmux.south)+(2ex,0) -- ++(2ex,-7ex) node[right, scale=0.7]{$V_{CC}$};

	\path (pin27)+(-1ex,-6ex) coordinate (eulerconnector) {};

	\path (eulerconnector) node[draw, opacity=0.5, minimum width=7ex, minimum height=22ex] {};
	\path (eulerconnector) node[scale=0.7, align=center] {Euler\\Connector\\\\};

	\node[fit=(pinmux) (devregs) (lastreg), draw, opacity=0.5, fill=black, fill opacity=0.03] (pio) {};

	\path (pio.south east) node[anchor=south east, scale=2, opacity=0.6] {PIO};

	\path (devregs)+(-18ex,0) node (sysbus) {System Bus};

	\tikzstyle{memrange} = [anchor=north, draw, minimum width=3ex, inner sep=0, outer sep=0]

	\path (sysbus.south) node[memrange, fill, fill opacity=0.03, draw opacity=0.5, minimum height=30ex] {};
	\path (sysbus.south)+(0,-25ex) node[memrange, fill=black, fill opacity=0.1, minimum height=1ex] (piobusaddr) {};

	\path (piobusaddr.south west) node[anchor=north east, scale=0.7, yshift=1ex] {0x1c20800};

	\draw[fill=black, draw opacity=0.2, fill opacity=0.05] (piobusaddr.north east) -- (pbcfg0.north west) -- (lastreg.south west) -- (piobusaddr.south east);

	\path (gpiotest)+(6ex,4ex) node (vaddr) {};

	\path (vaddr) node[anchor=south, scale=0.7, align=center] {Virtual\\Memory};

	\path (vaddr.south) node[memrange, fill=white, fill opacity=0.53, draw opacity=0.5, minimum height=10ex] {};
	\path (vaddr.south)+(0,-5ex) node[memrange, fill=black, fill opacity=0.1, minimum height=1ex] (piovirtaddr) {};


	\draw[fill=black, draw opacity=0.2, fill opacity=0.05]
	     (piovirtaddr.north east) -- (piobusaddr.north west) -- (piobusaddr.south west) -- (piovirtaddr.south east);

	\path (gpiotest |- sysbus) node (sysbus) {Genode};

	\path (eulerconnector |- sysbus) node (board) {Board};

\end{tikzpicture}

